package com.yan.messagesystem.domain;

/**
 * @author taoge
 * @Date 2024/7/31 17:02
 * @Description
 */
public class Message {
    private String name;
    private String date;
    private String title;
    private String content;

    public Message(String name, String date, String title, String content) {
        this.name = name;
        this.date = date;
        this.title = title;
        this.content = content;
    }

    public Message() {

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Message message = (Message) o;

        if (name != null ? !name.equals(message.name) : message.name != null) return false;
        if (date != null ? !date.equals(message.date) : message.date != null) return false;
        if (title != null ? !title.equals(message.title) : message.title != null) return false;
        return content != null ? content.equals(message.content) : message.content == null;
    }

    @Override
    public int hashCode() {
        int result = name != null ? name.hashCode() : 0;
        result = 31 * result + (date != null ? date.hashCode() : 0);
        result = 31 * result + (title != null ? title.hashCode() : 0);
        result = 31 * result + (content != null ? content.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return
               "留言人:" + name + "\t\t留言时间" + date + "\n"+
               "留言标题" + title + "\n" +
               "留言内容" + content;
    }


}
